package com.koron.housing.contract.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.housing.contract.bean.po.HousingContractRenewal;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 续租记录(HousingContractRenewal)表服务接口
 *
 * @author jzp
 * @since 2022-03-07 14:45:18
 */
public interface HousingContractRenewalService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    HousingContractRenewal getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param housingContractRenewal 查询条件对象
     * @return 列表结果集
     */
    List<HousingContractRenewal> list(SessionFactory factory, HousingContractRenewal housingContractRenewal);

    List<HousingContractRenewal> listByContractId(SessionFactory factory, String contractId);

    /**
     * 分页查询
     *
     * @param housingContractRenewal 分页条件
     * @return 对象列表
     */
    default PageInfo<HousingContractRenewal> page(SessionFactory factory, PageQuery pageQuery, HousingContractRenewal housingContractRenewal) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<HousingContractRenewal> housingContractRenewalList = list(factory, housingContractRenewal);
        return new PageInfo<>(housingContractRenewalList);
    }

    /**
     * 新增数据
     *
     * @param housingContractRenewal 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, HousingContractRenewal housingContractRenewal);

    /**
     * 修改数据
     *
     * @param housingContractRenewal 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, HousingContractRenewal housingContractRenewal);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

}
